package com.sky.mapper;/*
 *   sky-take-out
 *   com.sky.mapper
 *
 *   description:
 *   @data 2025/4/17     下午7:23
 *   @author 凉风
 */

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询套餐id
     * @param dishIds
     * @return
     */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 向套餐中批量插入菜品
     * @param dishes
     */
    void insertBatch(List<SetmealDish> dishes);

    /**
     * 批量删除套餐中关联的菜品
     * @param ids
     */
    void deleteByIds(List<Long> ids);

    /**
     * 根据id修改套餐相关菜品信息
     * @param setmealId
     */
    @AutoFill(value = OperationType.UPDATE)
    void updateById(Long setmealId);

    /**
     * TODO #{} 根据id查询套餐相关的菜品
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where id = #{id}")
    List<SetmealDish> getById(Long id);

    /**
     * TODO #{} 根据id删除套餐相关的菜品
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where id = #{id}")
    void deleteById(Long setmealId);

}
